<?php
/*
Template Name: Dettaglio Gioielli
*/
session_start();
?>
<style type="text/css">
a:link{
	text-decoration:none
}
.carattere {
	font-family: ADMUI3Lg;
	font-size:16px; 
	padding:0px 0px 0px 0px;
	color: #800080;
}
.carattere strong {
	color: #808000;
}
.colore_oro {
	color: #666;
	font-family: ADMUI3Lg;
	font-size:14px; 
	padding:0px
}
.prezzo {
	font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
	font-size: 30pt;
	font-weight: bold;
	font-style: normal;
	color: #FFF;
}
.specialprice {
	color: #EEE;
	font-size: 14pt;
	font-style: italic;
}
.not_registered{
	color: #fff;
	font-size: 10pt;
	font-style: italic;
}
.note{
	overflow-y: auto;
	overflow-x: none;
	max-height:130px; 
	text-align:justify; 
	margin-right:2px;
	padding-right:15px;
	margin-top:-5px;
}
.riquadro{
	background-image:url(<?php bloginfo('template_url');?>/images/riquadro_dettagllidescr.png); 
	background-repeat:no-repeat; 
	background-position:center center;
}
</style>
<?php get_header(); global $wpdb; ?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>



<?php get_sidebar('top'); ?>
    <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
            <td colspan="0" valign="top"><font color="#193E52" size="+2" face="Arial, Helvetica, sans-serif"><b><?php echo theme_get_meta_option($post->ID, 'theme_show_page_title') ? get_the_title() : ''?></b></font></td>
        </tr>
    </table>
<?php
$id = $_GET['id'];
$info_sql = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}preziosi WHERE id={$id}");
foreach ($info_sql as $info){
    $currency = $info->currency;
    $img = $info->foto;
    $code = $info->code;
    $altezza = $info->altezza;
    $lunghezza = $info->lunghezza;
    $profondità = $info->profondità;
    $prezzo = $info->prezzo;
    $note = $info->note;
    $varietà = $info->varietà;
    $type = $info->tipo;
    $carati = $info->carati;
    $cut = $info->taglio;
    $shape = $info->forma;
    $origine = $info->origine;
    $price_type = $info->price_type;
    $certificato = $info->certificato;		$datasheet_link = $info->datasheet_link;
}

$nome = $wpdb->get_var("SELECT nome FROM {$wpdb->prefix}subcat_preziosi WHERE id={$varietà}");
?>
<table width="723" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="738" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="437" height="437" align="center" valign="middle" style="background-image:url(<?php bloginfo('template_url');?>/images/riquadro_dettagllifotobig.png); background-repeat:no-repeat; background-position:center center">
            <!--
			<a> <img class="lente" id="foto" src="<?php echo network_home_url(); ?>/wp-content/uploads/lista/lista/grande_<?php echo $img; ?>" width="418" height="418" title="<?php echo ucfirst($nome); ?>" data-big="<?php echo network_home_url(); ?>/wp-content/uploads/lista/lista/grande_<?php echo $img; ?>"/>
            -->
			<?php
			$izoom = '[izoom] <a href="'.network_home_url().'/wp-content/uploads/lista/lista/grande_'.$img.'"><img src="'.network_home_url().'/wp-content/uploads/lista/lista/grande_'.$img.'" width="418" height="418" title="click to zoom '.ucfirst($nome).'."></a>[/izoom]';
			echo do_shortcode( $izoom ) ;
			?>
			<!--
			</a>
			-->
          </td>
          <td valign="top" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="258px" align="left" valign="top" class="riquadro">
                <table width="96%" border="0" align="center" cellpadding="5" cellspacing="5">
                  <tr>
                    <td class="carattere" colspan="2"><strong><?php echo ucfirst($nome); ?></strong></td>
                  </tr>
                  <tr>
                    <td colspan="2"><div class="note colore_oro"><?php echo ucfirst($note); ?></div></td>
                  </tr>
                  <tr>
                    <td class="carattere"><strong>Code</strong></td>
                    <td><div class="note colore_oro"><?php echo $code; ?></div></td>
                  </tr>
                  <tr>
                    <!--td><div class="note colore_oro"><?php echo $code; ?></div></td-->
                  </tr>
                  <?php if($carati && intval($carati)!=0): ?>
                  <tr>
                    <td class="carattere"><strong>Carat</strong></td>
                    <td><div class="note colore_oro"><?php echo $carati; ?></div></td>
                  </tr>
                  <tr>
                    <!--td><div class="note colore_oro"><?php echo $carati; ?></div></td-->
                  </tr>
                  <?php endif; ?>
                  <?php if($cut): ?>
                  <tr>
                    <td class="carattere"><strong>Cut</strong></td>
                    <td><div class="note colore_oro"><?php echo ucfirst($cut); ?></div></td>
                  </tr>
                  <tr>
                    <!--td><div class="note colore_oro"><?php echo $cut; ?></div></td-->
                  </tr>
                  <?php endif; ?>
                  <?php if($shape): ?>
                  <tr>
                    <td class="carattere"><strong>Shape</strong></td>
                    <td><div class="note colore_oro"><?php echo ucfirst($shape); ?></div>
                  </tr>
                  <tr>
                    <!--td><div class="note colore_oro"><?php echo $shape; ?></div></td-->
                  </tr>
                  <?php endif; ?>
                  <?php if($origine): ?>
                  <tr>
                    <td class="carattere"><strong>Origin</strong></td>
                    <td><div class="note colore_oro"><?php echo ucfirst($origine); ?></div></td>
                  </tr>
                  <tr>
                    <!--td><div class="note colore_oro"><?php echo $origine; ?></div></td-->
                  </tr>
                  <?php endif; ?>
                  <tr>
                    <td class="carattere"><strong>Dimensions</strong></td>
                    <?php if(true): ?>
                    <td>
                        <div class="note colore_oro">
                            <?php if( ($altezza<10)&&($lunghezza<10) || ($lunghezza<10)&&($profondità<10) || ($altezza<10)&&($profondità<10)){ ?>
                                <span class="Stile33" style="margin-left:2px">
                            <?php }else{?> 
                                <span class="Stile30" style="margin-left:2px">                                                
                            <?php }echo $altezza." x ".$lunghezza." x ".$profondità." mm"; ?></span>
                        </div>
                    </td>
                    <?php endif; ?>
                  </tr>	
				  <?php if($datasheet_link): ?>                  
					<tr>                    
						<td class="carattere"><strong>Datasheet link</strong></td>                    
						<td><div class="note colore_oro"><a target="_blank" href="<?php echo get_site_url();?>/wp-content/uploads/datasheet/<?php echo $datasheet_link ?>"/><?php echo $datasheet_link ?></a> </div>
						</td>                  
						</tr>                  <tr>                    <!--td><div class="note colore_oro"><?php echo $origine; ?></div></td-->                  </tr>                  <?php endif; ?>
<?php if($certificato): ?>
                  <tr>
                    <td class="carattere"><strong>Certificate</strong></td>
                    <td><div class="note colore_oro"><?php echo strtoupper($certificato); ?></div></td>
                  </tr>
                  <tr>
                    <!--td><div class="note colore_oro"><?php echo $certificato; ?></div></td-->
                  </tr>
                  <?php endif; ?>
                  <?php if(FALSE){ ?>
                  <tr>
                    <td>
                        <div class="note colore_oro">
                            <?php if( ($altezza<10)&&($lunghezza<10) || ($lunghezza<10)&&($profondità<10) || ($altezza<10)&&($profondità<10)){ ?>
                                <span class="Stile33" style="margin-left:2px">
                            <?php }else{?> 
                                <span class="Stile30" style="margin-left:2px">                                                
                            <?php }echo $altezza." x ".$lunghezza." x ".$profondità." mm"; ?></span>
                        </div>
                    </td>
                  </tr>
                  <?php } ?>
                </table>
              </td>
            </tr>
            <tr>
              <td height="105px" align="left" valign="middle" style="display:none;background-image:url(<?php bloginfo('template_url');?>/images/riquadro_dettaglliprezzo.png); background-repeat:no-repeat; background-position:center center"><table width="90%" border="0" align="center" cellpadding="5" cellspacing="0">
              <?php if (is_user_logged_in()){?>
                <tr>
                  <td align="right" class="specialprice">Price</td>
                </tr>
                <tr>
                    <?php 
                        $prezzoHtml='';
                        if($prezzo!=NULL){
                            $prezzoHtml = $prezzo." ".$currency;
                            $priceTypeHtml = $price_type=='cad'? 'per carat' : '';
                        }else 
                            $prezzoHtml .= "-";
                    ?>
                  <td align="right" valign="middle" class="prezzo"><?php echo $prezzoHtml; ?>
                      <span class="Stile33" style="margin-left:2px; font-size: 12px;"><?php echo $priceTypeHtml; ?></span></td>
                </tr>
               <?php }else{
                    echo "
                    <tr>
	                    <td class='not_registered'>
	                    	PRICE ONLY ON REQUEST <!-- <a href='#'>click here</a> -->
	                    </td>
                    </tr>"; 
			   }?>
              </table></td>
            </tr>
            <tr>
              
            </tr>
          </table></td>
        </tr>
        <tr>
          <td style="padding:0px 10px 0px 10px">
			<span class="art-button-wrapper"> 
			<span class="l"> </span> 
			<span class="r"> </span> 
			<a class="art-button" href="javascript:history.back()">Back to category</a> 
			</span>
			<!--span class="art-button-wrapper"> 
			<span class="l"> </span> 
			<span class="r"> </span> 
			<a class="art-button" href="#">Request info</a> 
			</span-->
		</td>
        </tr>
      </table></td>
  </tr>
</table>